/*===========================================================================================================================
	Wolf Prop Protection
		By Goluch
			DO NOT UPLOAD TO GARRYSMOD.ORG
			
			
	Name: WPP.SetOwner
	Purpose: Sets the owner of an object.
	Author: Goluch
===========================================================================================================================*/
function WPP:SetOwner(Entity,Player)
	if ( !WPP:IsValid(Entity) ) then
		return;
	end
	
	Entity:SetNWEntity("WWP_Owner",Player);
	Entity:SetNWString("WWP_Owner_Steam",Player:SteamID());
	
	if ( Player:IsSuperAdmin() ) then
		Entity.WPP_SuperAdmin_Prop = true
	elseif( Player:IsAdmin() ) then
		Entity.WPP_Admin_Prop = true
	end
	
end

/*===========================================================================================================================		
	Name: WPP.GetOwner
	Purpose: Gets the owner of an object.
	Author: Goluch
===========================================================================================================================*/
function WPP:GetOwner(Entity)
	if ( !WPP:IsValid(Entity) ) then
		return;
	end
	
	local Player = Entity:GetNWEntity("WWP_Owner");
	if ( Player ) and ( Player:IsValid() ) and ( Player:IsPlayer() ) then
		return Player;
	end
	
end

/*===========================================================================================================================		
	Name: WPP.GetOwnerSteam
	Purpose: Gets the owner of an object as a steam id.
	Author: Goluch
===========================================================================================================================*/
function WPP:GetOwnerSteam(Entity)
	if ( !WPP:IsValid(Entity) ) then
		return;
	end
	
	local Steam = Entity:GetNWString("WWP_Owner_Steam","");
	if ( Steam != "" ) then
		return Steam;
	end
	
	return false;
end

/*===========================================================================================================================		
	Name: WPP.IsOwner
	Purpose: Checks player ownership.
	Author: Goluch
===========================================================================================================================*/
function WPP:IsOwner(Entity,Player)
	if ( !WPP:IsValid(Entity) ) then
		return;
	end
	
	local Owner = Entity:GetNWEntity("WWP_Owner");
	if ( Owner ) and ( Owner:IsValid() ) and ( Owner:IsPlayer() ) then
		return Player == Owner;
	end
	
	return false;
end

/*===========================================================================================================================		
	Name: WPP.IsOwned
	Purpose: Checks if an object is owned.
	Author: Goluch
===========================================================================================================================*/
function WPP:IsOwned(Entity)
	if ( self:GetOwner(Entity) ) then
		return true;
	end
	
	if ( self:GetOwnerSteam(Entity) ) then
		return true;
	end
	
	return false;
end